package com.test.base;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Paths;

public class CodeGenerator {

    public static void main(String[] args) {
        FastAutoGenerator.create(
                    "jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&allowMultiQueries=true&useSSL=false&serverTimezone=UTC",
                    "root",
                    "ang12345"
                ).globalConfig(builder -> builder
                        .author("ssang")
                        .outputDir("/Users/angss/Desktop/demo/java")
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.test")
                        .entity("entity")
                        .mapper("mapper")
                        .service("service")
                        .serviceImpl("service.impl")
                        .xml("mapper.xml")
                )
                .strategyConfig(builder -> builder
                        .addInclude("flow_template_data") // 设置需要生成的表名，不写就是所有表
                        .addTablePrefix("t_", "c_") // 设置过滤表前缀
                        .entityBuilder()
                        .enableLombok()
                        .enableTableFieldAnnotation()//@TableFiled注解
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
